Switch Statement (Custom Formula)

Use the switch / case statement inside your the node editor.

There's currently no native switch / case statement in toddle. So if you wanted to use a switch statement inside the node editor you had to create a custom formula. 

Using this package, you can add the switch / case node straight into your editor and visually set up a switch statement.

Formulas

  • switchStatement

    A 'node' that acts as a switch / case statement

    Arguments

    switchInputEquivalent to value that goes in switch(value) of the traditional switch statement 
    casesEquivalent to the case - return of the traditional switch statement. 
    defaultValueEquivalent to default of the traditional switch statement 

Example

Enter an integer to convert it to month & season 

Month: null
Season: null

Breakdown

Enter an animal to check its type (elephant, tiger, bear, and pig)

Type:null

⚠️ Important

Each object in cases argument array must be in {case, result} format. (with exact key names "case" and "result" )